using System;
using System.Collections.Generic;
using System.Text;
using Omniture.Studio.Objects;

namespace Omniture.Studio
{
	internal static class Globals
	{		
		//private static ProgressForm _progress = null;
		//private static DateTime  _progressStart;
		private static IProgressPanel _panel = null;

		public static void SetPanel(IProgressPanel panel)
		{
			_panel = panel;
		}

		//public static void ShowProgress()
		//{
		//  ShowProgress("");
		//}

		public static string ShowProgress(string text)
		{
			//_progress = new ProgressForm(text);
			//_progress.Show();
			//System.Windows.Forms.Application.DoEvents();
			//_progressStart = DateTime.Now;

			return _panel.ProcessStart(text);
			//System.Windows.Forms.Application.DoEvents();
			//_progressStart = DateTime.Now;

		}

		public static void HideProgress(string unlockKey)
		{
			//Some of the loads and unloads are so quick it is ugly, 
			//keep progress screen visible for a minimum time
			//while (DateTime.Now.Subtract(_progressStart).TotalSeconds < 2)
			//{
			//  System.Windows.Forms.Application.DoEvents();
			//}

			//if (_progress != null) _progress.Close();
			//_progress = null;
			//System.Windows.Forms.Application.DoEvents();

			_panel.ProcessComplete(unlockKey);
			//System.Windows.Forms.Application.DoEvents();

		}

	}
}
